package com.hzw.saas.web.hbox.param;

import java.io.Serializable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @author zzl
 * @since 03/01/2021
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel("Loc分片上传参数")
public class LocChunkPostParam implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 文件ID
     */
    @ApiModelProperty(value = "文件ID", position = 2, required = true)
    @NotBlank(message = "文件ID不可为空")
    private String fileId;

    /**
     * 起始字节数，从1开始
     */
    @ApiModelProperty(value = "起始字节数，从1开始", position = 3, required = true)
    @NotNull(message = "文件分片起始字节数不可为空")
    private Long startBytes;

    /**
     * 结束字节数
     */
    @ApiModelProperty(value = "结束字节数", position = 4, required = true)
    @NotNull(message = "文件分片结束字节数不可为空")
    private Long endBytes;

    /**
     * 当前分片摘要，MD5
     */
    @ApiModelProperty(value = "当前分片摘要，MD5", position = 5)
    private String digest;

    /**
     * 分片对象
     */
    @ApiModelProperty(value = "分片文件", position = 8, required = true)
    @NotNull(message = "分片文件不可为空")
    private transient MultipartFile file;

    @Override
    public String toString() {
        return "{" +
                "fileId='" + fileId + '\'' +
                ", startBytes=" + startBytes +
                ", endBytes=" + endBytes +
                ", digest='" + digest + '\'' +
                '}';
    }
}
